#include <REGX52.H>

void delay_ms(unsigned int ms)
{
    unsigned int i, j;
    for (i = 0; i < ms; i++)
    {
        for (j = 0; j < 123; j++)
            ;
    }
}

void main()
{
    while (1)
    {
        P2 = 0x7F; // 01111111
        delay_ms(500);
        P2 = 0xBF; //101111111
        delay_ms(500);
        P2 = 0xDF; //11011111
        delay_ms(500);
        P2 = 0xEF; //11101111
        delay_ms(500);
        P2 = 0xF7; //11110111
        delay_ms(500);
        P2 = 0xFB; //11111011
        delay_ms(500);
        P2 = 0xFD; //1111101
        delay_ms(500);
        P2 = 0xFE; // 11111110
        delay_ms(500);
        P2 = 0x00; // 所有灯亮
        delay_ms(500);
    }
}